//
// Created by lfm on 25-4-23.
//

#include <iostream>
#include <string>
#include <list>
using namespace std;


class Person
{
public:
    Person(string name , int age,int heigh) :
    m_Name(name), m_Age(age) ,m_Heigh(heigh){}
public:
    string m_Name;
    int m_Age;
    int m_Heigh;
};
void printList(list<Person>& l )
{
    for (list<Person>::iterator it = l.begin(); it != l.end(); it ++)
    {
        cout << "姓名" << (*it).m_Name << "年龄" << it->m_Age << "身高" << it->m_Heigh << endl;
    }
    cout << "===========================================" << endl;
}

bool cmp(Person & p1, Person & p2)
{
    return p1.m_Age < p2.m_Age;
}

void test01()
{
    list<Person> L;
    Person p1("sdf", 234,89);
    Person p2("fddsj", 34, 33);
    Person p3("fdsfd", 434, 78);
    Person p4("dsfsd", 89, 34);
    Person p5("fddsf", 989, 32);

    L.push_back(p1);
    L.push_back(p2);
    L.push_back(p3);
    L.push_back(p4);
    L.push_back(p5);

    printList(L);
    L.sort(cmp);
    printList(L);
}

int main()
{
    test01();
    return 0;
}